package com.kernelstudio.framework.compatible.supports.jdbc;
/*
 * This file is part of the kernelstudio package.
 *
 * (c) 2014-2024 zlin <admin@kernelstudio.com>
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 */

import com.kernelstudio.framework.compatible.DatabaseCompatibleMode;
import com.kernelstudio.framework.compatible.configurer.CompatibleConfigurer;
import org.springframework.data.relational.core.dialect.MySqlDialect;
import org.springframework.data.relational.core.dialect.OracleDialect;
import org.springframework.data.relational.core.dialect.PostgresDialect;

public class CompatibleJdbcDialectProviderConfigurer implements CompatibleConfigurer {

    @Override
    public void configure(DatabaseCompatibleMode databaseCompatibleMode) {
        switch (databaseCompatibleMode) {
            case ORACLE:
                CompatibleJdbcDialectProvider.DIALECT = OracleDialect.INSTANCE;
                break;
            case MYSQL:
                CompatibleJdbcDialectProvider.DIALECT = MySqlDialect.INSTANCE;
                break;
            case POSTGRES:
                CompatibleJdbcDialectProvider.DIALECT = PostgresDialect.INSTANCE;
                break;
        }
    }
}
